package question1;

public class FindLast {

	public static void main(String[] args) {
		int[] x = { 2, 3, 5 };
		int y = 2;

		FindLast fL = new FindLast();
		int k = fL.findLast(x, y);
		System.out.println(k);
	}

	public int findLast(int[] x, int y) {
		for (int i = x.length - 1; i > -1; i--) {
			if (x[i] == y) {
				return i;
			}
		}
		return -1;
	}
}
